package com.turing.post.report.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "MerchantBusinessDaySettlement")
@IdClass(MerchantBusinessDaySettlement.class)
public class MerchantBusinessDaySettlement implements Serializable {

	public MerchantBusinessDaySettlement() {
		super();
	}

	/**
	 * 商户NO
	 */
	private String merchantNo;

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	/**
	 * 帐务日期
	 */
	private Date tranDate;

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	/**
	 * 业务类型
	 */
	private String businessType;

	@Id
	@Column(name = "BUSINESSTYPE", nullable = false)
	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}

	/**
	 * 发卡商NO
	 */
	private String issueCompanyNo;

	@Column(name = "ISSUECOMPANYNO", nullable = false)
	public String getIssueCompanyNo() {
		return issueCompanyNo;
	}

	public void setIssueCompanyNo(String issueCompanyNo) {
		this.issueCompanyNo = issueCompanyNo;
	}

	/**
	 * 本日消费(预付卡+积分)
	 */
	private BigInteger consume;

	@Column(name = "CONSUME", nullable = false)
	public BigInteger getConsume() {
		return consume;
	}

	public void setConsume(BigInteger consume) {
		this.consume = consume;
	}

	/**
	 * 本日退货
	 */
	private BigInteger cancelPaid;

	@Column(name = "CANCELPAID", nullable = false)
	public BigInteger getCancelPaid() {
		return cancelPaid;
	}

	public void setCancelPaid(BigInteger cancelPaid) {
		this.cancelPaid = cancelPaid;
	}

	/**
	 * 其他消费金额
	 */
	private BigInteger otherPaid;

	@Column(name = "OTHERPAID", nullable = false)
	public BigInteger getOtherPaid() {
		return otherPaid;
	}

	public void setOtherPaid(BigInteger otherPaid) {
		this.otherPaid = otherPaid;
	}

	/**
	 * 结算比率
	 */
	private BigInteger settRatio;

	@Column(name = "SETTRATIO", nullable = false)
	public BigInteger getSettRatio() {
		return settRatio;
	}

	public void setSettRatio(BigInteger settRatio) {
		this.settRatio = settRatio;
	}

	/**
	 * 手续费收入
	 */
	private BigInteger income;

	@Column(name = "INCOME", nullable = false)
	public BigInteger getIncome() {
		return income;
	}

	public void setIncome(BigInteger income) {
		this.income = income;
	}

	/**
	 * 成本
	 */
	private BigInteger cost;

	@Column(name = "COST", nullable = false)
	public BigInteger getCost() {
		return cost;
	}

	public void setCost(BigInteger cost) {
		this.cost = cost;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getTranDate(), getBusinessType() });
	}

	@Override
	public boolean equals(Object obj) {
		if ((this == obj))
			return true;
		if ((obj == null))
			return false;
		if (!(obj instanceof MerchantBusinessDaySettlement))
			return false;
		MerchantBusinessDaySettlement other = (MerchantBusinessDaySettlement) obj;

		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;

		if (!PCPSUtil.compareObject(this.getTranDate(), other.getTranDate()))
			return false;

		return PCPSUtil.compareObject(this.getBusinessType(), other
				.getBusinessType());
	}
}